# $Id: CMakeLists.txt 34 2009-01-11 19:21:23Z rodlima $

cmake_minimum_required(VERSION 2.6)
enable_testing()

project(cppobjects CXX)
set(VER_MAJOR 0)
set(VER_MINOR 1)
set(VER_PATCH 0)

# Version: MAJOR.MINOR.PATCH.REV
# MAJOR increments only when there's an ABI incompatibility
# MINOR when features are added, without ABI incompatibilities
# PATCH when bugs are corrected, no feature additions
# REVISION denotes the subversion revision

string(REGEX MATCH "[0-9]+" REVISION "$Revision: 34 $")

math(EXPR API_INTERFACE ${VER_MAJOR}+${VER_MINOR})
math(EXPR API_AGE ${VER_MINOR})
math(EXPR API_PATCH ${VER_PATCH})

set(VERSION ${VER_MAJOR}.${VER_MINOR}.${VER_PATCH}.${REVISION})
set(SOVERSION ${API_INTERFACE}.${API_PATCH}.${API_AGE})

if(NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE Release)
endif()

set(PostgreSQL_DIR ${CMAKE_SOURCE_DIR}/cmake)
set(PQXX_DIR ${CMAKE_SOURCE_DIR}/cmake)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
set(Boost_ADDITIONAL_VERSIONS 1.37)
include(PCHSupport)

set(CMAKE_CXX_FLAGS_RELEASE "-Wall -std=gnu++0x ${CMAKE_CXX_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_DEBUG "-std=gnu++0x ${CMAKE_CXX_FLAGS_DEBUG} -O0 -ggdb")

find_package(Doxygen)
find_package(PQXX REQUIRED)
find_package(Boost 1.35.0 REQUIRED regex thread date_time serialization unit_test_framework)

add_subdirectory(src)
add_subdirectory(testsuite)
add_subdirectory(doc EXCLUDE_FROM_ALL)
